color-widget: don't use a GtkAlignment to center the color editor
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 9 Feb 2012 20:10:21 +0000 (15:10 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 14 Feb 2012 21:37:01 +0000 (16:37 -0500)
We can just use a GtkBox, and set hexpand=TRUE/halign=CENTER to allocate
the editor in the middle of the box.

gtk/gtkcolorchooserwidget.c

index 1e0e3a1ddda5e6907371df1884ea0f554816fcd9..8ca633fb5a375a9146b66582ee2e599f0586f1c1 100644 (file)
@@ -31,7 +31,6 @@
 #include "gtkprivate.h"
 #include "gtkintl.h"
 #include "gtksizegroup.h"
-#include "gtkalignment.h"
 
 #include <math.h>
 
@@ -435,7 +434,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
 {
   GtkWidget *box;
   GtkWidget *p;
-  GtkWidget *alignment;
   GtkWidget *button;
   GtkWidget *label;
   gint i;
@@ -502,9 +500,12 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
   g_variant_unref (variant);
 
   cc->priv->editor = gtk_color_editor_new ();
-  alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
-  gtk_container_add (GTK_CONTAINER (cc), alignment);
-  gtk_container_add (GTK_CONTAINER (alignment), cc->priv->editor);
+  gtk_widget_set_halign (cc->priv->editor, GTK_ALIGN_CENTER);
+  gtk_widget_set_hexpand (cc->priv->editor, TRUE);
+
+  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_container_add (GTK_CONTAINER (cc), box);
+  gtk_container_add (GTK_CONTAINER (box), cc->priv->editor);
 
   g_settings_get (cc->priv->settings, "selected-color", "(bdddd)",
                   &selected,
@@ -521,7 +522,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
 
   cc->priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
   gtk_size_group_add_widget (cc->priv->size_group, cc->priv->palette);
-  gtk_size_group_add_widget (cc->priv->size_group, alignment);
+  gtk_size_group_add_widget (cc->priv->size_group, box);
 }
 
 /* GObject implementation {{{1 */